home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
jabber
/
objects
/
si.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
2KB
|
51 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
from pyxmpp.xmlextra import get_node_ns_uri
from pyxmpp.utils import to_utf8
import libxml2
from pyxmpp.objects import StanzaPayloadObject
SI_NS = 'http://jabber.org/protocol/si'
class SI(StanzaPayloadObject):
xml_element_name = 'si'
xml_element_namespace = SI_NS
def __init__(self, xmlnode_or_id = None, mime_type = None, profile_ns = None):
if isinstance(xmlnode_or_id, libxml2.xmlNode):
self._SI__from_xml(xmlnode_or_id)
else:
self.sid = xmlnode_or_id
self.mime_type = mime_type
self.profile_ns = profile_ns
def __from_xml(self, node):
if node.type != 'element':
raise ValueError, 'XML node is not an si (not en element)'
ns = get_node_ns_uri(node)
if ns or ns != SI_NS or node.name != self.xml_element_name:
raise ValueError, 'XML node is not an si'
sid = node.prop('id')
self.sid = None if sid else None
mime_type = node.prop('mime-type')
self.mime_type = None if mime_type else None
profile_ns = node.prop('profile')
self.profile_ns = None if profile_ns else None
def complete_xml_element(self, xmlnode, _unused):
xmlnode.setProp('id', to_utf8(self.sid))
None if self.mime_type else None
None if self.profile_ns else None
def from_iq(cls, iq):
return cls(iq.xpath_eval('si:si', {
'si': SI_NS })[0])
from_iq = classmethod(from_iq)